;; JavaFX Mode - A GNU Emacs major mode for editing JavaFX Script
;; Copyright (c) 2008, 2009, Iparelan Solutions, LLC. All rights reserved.

;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <http://www.gnu.org/licenses/>.

;; Author: Greg Mattes
;; Version: February 2009

(require 'generic-x)

(defgroup javafx-script nil
  "Major mode for edit JavaFX Script source code."
  :group 'languages
  :prefix "javafx-script-")

(defconst javafx-script-version "0.9.2"
  "JavaFX Script Mode version")

(defun javafx-script-version ()
  "Show JavaFX Script Mode version in the minibuffer."
  (interactive)
  (message "JavaFX Script Mode version %s" javafx-script-version)
  (c-keep-region-active))

(defconst javafx-script-keywords
  '("abstract" "attribute" "bind" "break" "class" "continue" "delete" "false" "for" "function" "if" "import" "init" "insert" "new" "not" "null" "package" "private" "public" "return" "super" "sizeof" "static" "this" "throw" "try" "true" "var" "while" "after" "and" "as" "before" "catch" "dur" "else" "exclusive" "extends" "finally" "in" "bound" "indexof" "into" "inverse" "lazy" "on" "or" "replace" "step" "with" "where" "instanceof" "override" "at" "then" "tween" "assert" "by" "do" "first" "from" "last" "let" "protected" "readonly" "typeof" "lazy")
  "List of JavaFX Script keywords.")

(defconst javafx-script-comment-syntax
  '("//" ("/*" . "*/"))
  "JavaFX Script comment syntax.")

(defconst javafx-script-font-lock-list
  '(("%{\\([A-Z_]+\\)}" 1 font-lock-variable-name-face))  ; variables
  "A list of JavaFX Script syntax for font lock highlighting.")

(defconst javafx-script-auto-mode-alist
  '("\\.fx\\'")
  "JavaFX Script source code file extension for automatic mode detection.")

(defconst javafx-script-function-list
  (list '(lambda () (setq mode-name "JavaFX Script")))
  "List of functions called when entering JavaFX Script
  mode. These functions are called be those functions in
  `javafx-script-mode-hook'.")

(define-generic-mode javafx-script-mode
  javafx-script-comment-syntax  
  javafx-script-keywords
  javafx-script-font-lock-list
  javafx-script-auto-mode-alist
  javafx-script-function-list
  "Major mode for JavaFX Script.
\\{javafx-script-mode-map}")

(provide 'javafx-script-mode)
